class Admin::UserCustomsController < Admin::ApplicationController
  before_action :set_user_custom, only: [:show, :edit, :update, :destroy]

  # GET /admin/user_customs
  def index
    @user_customs = UserCustom.all
  end

  # GET /admin/user_customs/1
  def show
  end

  # GET /admin/user_customs/new
  def new
    @user_custom = UserCustom.new
  end

  # GET /admin/user_customs/1/edit
  def edit
  end

  # POST /admin/user_customs
  def create
    @user_custom = UserCustom.new(user_custom_params)

    if @user_custom.save
      redirect_to [:admin, @user_custom], notice: '创建成功'
    else
      render :new
    end
  end

  # PATCH/PUT /admin/user_customs/1
  def update
    if @user_custom.update(user_custom_params)
      redirect_to [:admin, @user_custom], notice: '更新成功'
    else
      render :edit
    end
  end

  # DELETE /admin/user_customs/1
  def destroy
    @user_custom.destroy
    redirect_to admin_user_customs_url, notice: '删除成功'
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_user_custom
      @user_custom = UserCustom.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def user_custom_params
      params.require(:user_custom).permit(:phone, :wechat_img)
    end
end
